package jp.sourceforge.akjrcp.audiotools;

import jp.sourceforge.akjrcp.akj_betas.Messages;
import jp.sourceforge.akjrcp.commons.ui.widget.LayoutDataBuilder;
import jp.sourceforge.akjrcp.commons.ui.widget.WidgetBuilder;
import jp.sourceforge.akjrcp.ui.param.ParamItem;
import jp.sourceforge.akjrcp.ui.param.ParamItemActionListener;
import jp.sourceforge.akjrcp.ui.param.ParamRadioGroup;
import jp.sourceforge.akjrcp.ui.param.ParamTime;
import jp.sourceforge.akjrcp.util.TimeUtils;

import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;

/*
 * still development?
 */
public class SubtitleInsertDialog extends  Dialog{
	
	boolean isLine=true;
	String lines="";
	String title;
		public SubtitleInsertDialog(Shell parentShell, String dialogTitle) {
			super(parentShell);
			this.title=dialogTitle;
		}
		
		protected void configureShell(Shell newShell) {
			super.configureShell(newShell);
			newShell.setText(title);
		}
		
		  protected Control createDialogArea(Composite root) {
			  root.setLayout(new GridLayout(1,false));
			  ParamRadioGroup type=new ParamRadioGroup(root,SWT.NULL,"mode",Messages.getString("insertdialog.mode"),new String[]{Messages.getString("insertdialog.line"),Messages.getString("insertdialog.char")},new String[]{Messages.getString("insertdialog.line"),Messages.getString("insertdialog.char")},2);
			  type.setParamItemActionListener(new ParamItemActionListener(){

				@Override
				public void paramItemModified(ParamItem item) {
					isLine=item.getValue().equals(Messages.getString("insertdialog.line"));
				}
			  });
			 
			  final Text text= WidgetBuilder.createTextArea(root, "");
			  text.setLayoutData(LayoutDataBuilder.hintGridData(600, 400));
			  text.addModifyListener(new ModifyListener(){

				@Override
				public void modifyText(ModifyEvent e) {
					lines=text.getText();
				}});
		      return root;
		    }

		public boolean isLine() {
			return isLine;
		}

		public void setLine(boolean isLine) {
			this.isLine = isLine;
		}

		public String getLines() {
			return lines;
		}

		public void setLines(String lines) {
			this.lines = lines;
		}


	
	

	}
